﻿@{
    ViewBag.Title = "升级全国会员卡申请";
    Layout = "~/Views/Shared/_BootstrapUI.cshtml";
}

<link href="~/Content/dataTable/dtConfig.css" rel="stylesheet" />
<link href="~/Content/dataTable/select.dataTable.css" rel="stylesheet" />
<script src="~/Content/fileInput/js/fileinput.min.js"></script>
<script src="~/Content/fileInput/js/zh.js"></script>
<link href="~/Content/fileInput/css/fileinput.min.css" rel="stylesheet" />

<div class="panel panel-default mb0">
    <div class="panel-body bb panel_inquire">
        <form id="form_inquire" role="form" class="form-inline">
            <div class="form-group">
                <input id="query" type="text" class="form-control" placeholder="会员名称" style="width: 200px;">
            </div>
            <div class="form-group">
                <select id="carstate" type="text" style="width:120px" placeholder="状态" class="form-control  input-sm input-sm" required="required" data-parsley-error-message="...">
                    <option value=""></option>
                    <option value="0">待确认</option>
                    <option value="1">已激活</option>
                    <option value="2">已拒绝</option>

                </select>
            </div>
            <button id="btnInquire" type="button" class="btn btn-primary">查&nbsp;询</button>
        </form>
    </div>
    <input type="hidden" id="btn_val" />
    <div id="btnOp" class="panel-heading">
    </div>
    <div class="panel-body bt panel-body-dt-normal">
        <div class="table-responsive">
            <table id="dt_admin" class="table table-striped nowrap"></table>
        </div>
    </div>
</div>



<div id="ImportModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabelLarge" aria-hidden="true" class="modal fade">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" data-dismiss="modal" aria-label="Close" class="close">
                    <span aria-hidden="true">&times;</span>
                </button>
                <h4 id="titleimport" class="modal-title">导入确认数据</h4>
            </div>
            <div class="modal-body">
                <form>
                    <div class="row" style="padding:12px">
                        <label class="col-md-4 control-label">导入文件</label>
                        <div class="col-md-8">
                            <div class="modal-body">
                                <input type="file" name="txt_file" id="txt_file" multiple class="file-loading" />
                            </div>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>



<script src="~/Content/datetimePicker/moment.js"></script>
<script src="~/Content/datetimePicker/datetimePicker.js"></script>
<script src="~/Pscripts/RescueCard/CarUpgrade.js?v=@DateTime.Now.ToString("yyyyMMddHHmmssfff")"></script>
<script>
    $(function () {
        //0.初始化fileinput
        var oFileInput = new FileInput();
        oFileInput.Init("txt_file", "/RescueCard/ReviewCard");
    });
    //初始化fileinput
    var FileInput = function () {
        var oFile = new Object();

        //初始化fileinput控件（第一次初始化）
        oFile.Init = function (ctrlName, uploadUrl) {
            var control = $('#' + ctrlName);
            //初始化上传控件的样式
            control.fileinput({
                language: 'zh', //设置语言
                uploadUrl: uploadUrl, //上传的地址
                allowedFileExtensions: ['xlsx', 'xls'],//接收的文件后缀
                showUpload: true, //是否显示上传按钮
                showCaption: false,//是否显示标题
                browseClass: "btn btn-primary",
                maxFileCount: 10, //表示允许同时上传的最大文件个数
                enctype: 'multipart/form-data',
                validateInitialCount: true,
                previewFileIcon: "<i class='glyphicon glyphicon-king'></i>",
                msgFilesTooMany: "选择上传的文件数量({n}) 超过允许的最大数值{m}！",
                uploadExtraData: function () {//向后台传递参数
                    var data = {
                        time: $('#date_im').val(),
                        method: $('#immethod').val()
                    };
                    return data;
                }
            });

            //导入文件上传完成之后的事件
            $("#txt_file").on("fileuploaded", function (event, data, previewId, index) {
                var data = data.response;
                if (data.IsSucceed) {
                    $("#ImportModal").modal("hide");
                    $.notify({
                        message: '<i class="fa ' + (data.IsSucceed ? 'fa-check' : 'fa-exclamation') + '"></i> ' + data.Message,
                        status: data.IsSucceed ? 'success' : "danger",
                        pos: "bottom-right"
                    });
                    loadTableData();
                } else if (!data.IsSucceed) {
                    $.notify({
                        message: '<i class="fa ' + (data.IsSucceed ? 'fa-check' : 'fa-exclamation') + '"></i> ' + data.Message,
                        status: data.IsSucceed ? 'success' : "danger",
                        pos: "bottom-right"
                    });
                    loadTableData();
                }
                else {
                    if (data.Entity != "" && data.Entity != null)
                        window.parent.location.href = data.Entity;
                }
            });
        }
        return oFile;
    };
</script>
